using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CECompactRunApp
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = @"\Windows";
            openFileDialog1.Filter = "All apps (*.exe)|*.exe|Anything (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;

            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                try
                {
                    string filename = openFileDialog1.FileName;
                    System.Diagnostics.Process proc = new System.Diagnostics.Process();
                    proc.EnableRaisingEvents = false;
                    proc.StartInfo.FileName = filename;
                    proc.Start();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not run app. Original error: " + ex.Message);
                }
            }
            Application.Exit();

        }
    }
}
